<?php
class ResourceRepertoireInfo extends Resource
{
	private $RepertoireItemID;
	private $ComposerID;
	private $Title;
	private $Arranger;
	private $Key;
	private $Organ;
	private $Voices;
	private $Publisher;
	private $Copyright;
	private $Words;
	private $Translation;
	
	
	public function __construct($database, $resourceID)
	{
		$this->database = $database;
		parent::__construct($database, $resourceID);
		
		
		if ($resourceID != 0)
		{
//			echo $resourceID;
			$sql = "SELECT * from RepertoireItems WHERE ResourceIDP=".$this->resourceID;
			$this->database->ExecuteSQL($sql);
//			echo $this->database->getNumRows();
			$row = $this->database->getRow();
			
//			print_r ($row);
			
			$this->RepertoireItemID = $row['RepertoireItemID'];
			$this->ComposerID = $row['ComposerIDT'];
			$this->Title = $row['Title'];
			$this->Arranger = $row['Arranger'];
			$this->Key = $row['PrincipalKey'];
			$this->Organ = $row['Organ'];
			$this->Voices = $row['Voices'];
			$this->Publisher = $row['Publisher'];
			$this->Copyright = $row['Copyright'];
			$this->Words = $row['Words'];
			$this->Translation = $row['Translation'];

		}
			
	}
	
	public function getFullHTML()
	{
//		$html = "<span class=\"ListMainTitle\">".$this->title."</span>\n";
		$composer = new ResourceComposer($this->database,0);
		$composer->loadComposer($this->ComposerID);
		$html = $composer->getFullHTML();
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Title:</span><span class=\"ListDescription\">".$this->Title."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Arranged by:</span><span class=\"ListDescription\">".$this->Arranger."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Key:</span><span class=\"ListDescription\">".$this->Key."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Voices:</span><span class=\"ListDescription\">".$this->Voices."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Accompaniment:</span><span class=\"ListDescription\">".$this->Organ."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Published by:</span><span class=\"ListDescription\">".$this->Publisher."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Copyright:</span><span class=\"ListDescription\">".$this->Copyright."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Words:</span><span class=\"ListDescription\">".str_replace("\n","<br>\n",$this->Words)."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		$html .= "<span class=\"ListTitle\">Translation:</span><span class=\"ListDescription\">".str_replace("\n","<br>\n",$this->Translation)."</span>\n";
		$html .= "<p class=\"floatstop\" />\n";
		return $html;
	}
}

?>